package com.chenye.jpa.entity;

import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * @Auther:chenye
 * @Data:2018/5/14
 * @Description:
 */
@Entity
@Table(name = "detail")
@Data
@ToString
public class Detail {
    @Id
    private Integer id;

    @Column(name = "user_Id")
    private Integer userId;

    @Column
    private String detail;

    @Column(name = "user_age")
    private Integer userAge;

    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name = "id")
    //for collection
//    @Where(clause = "age = 12")
//    @OrderBy("id")
    private User user;
}
